package Main;

import Book.BookList;
import User.AdminUser;
import User.NormalUser;
import User.User;

import java.util.Scanner;

public class Main {
    public static User func() {
        System.out.println("请输入你的姓名：");
        Scanner sc = new Scanner(System.in);
        String name = sc.nextLine();
        System.out.println("请选择你的身份：1.管理员；2.用户");
        int choice = sc.nextInt();
        if (choice==1){
            return new AdminUser(name);
        } else {
            return new NormalUser(name);
        }
    }

    public static void main(String[] args) {
        User user = func();
        BookList bookList = new BookList();
        while (true) {
            int choice = user.menu();
            user.DoWork(choice, bookList);
        }
    }
}
